package com.sinven.controller;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.sinven.pojo.User;
import com.sinven.service.UserService;
@Controller
public class RegisterController {
	@Autowired
	private UserService userService;

	@PostMapping("register")
	@ResponseBody
	public boolean doregister(User user) {
		user.setU_createtime(new Date());
		System.out.println("我是注册");
		System.out.println(user.getU_password()+user.getU_name());
		try {
			boolean res=userService.AddUser(user);
			if(res) {
				return true;
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}
